using System.Text;
using System.Linq;
using System;
using System.Collections.Generic;

namespace Elderos.Highlight.Search
{
    /// <summary>
    /// ISearchStrategy represents an object responsible for finding 
    /// positions of named entities in text and linking them to database entities.
    /// </summary>
    public interface ISearchStrategy
    {
        /// <summary>
        /// Contains initialization logic for deferred initialization.
        /// </summary>
        void Initialize();

        /// <summary>
        /// Indicates if <see cref="Initialize()"/> method was successfully called
        /// </summary>
    	bool IsInitialized { get; }

        /// <summary>
        /// Searches text for named entities and links them to database entities.
        /// </summary>
        /// <param name="text"></param>
        /// <returns></returns>
        List<Position> Search(PreparedText text);
        
        /// <summary>
        /// Event is called when initialization makes some progress.
        /// </summary>
        event InitializationProgressHandler InitializationProgress;
    }

    public delegate void InitializationProgressHandler(double percentComplete, int count, int total);
}